﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Cwing.UI.Controls;

public partial class Server_Validate_Event : ValidationPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        CustomizeValidation cv = new CustomizeValidation("1", ErrorList1);
        cv.Path = "//Control[@ID='Number']";
        cv.Validated += new Cwing.UI.Validation.ControlValidated(cv_Validated);
        CustomizeValidations.Add(cv);
    }

    void cv_Validated(Cwing.UI.Validation.ValidateEventArgs e, Cwing.UI.Validation.ValidationResult result)
    {
        if (result.Result)
        {
            //result = new Cwing.UI.Validation.ValidationResult();
            result.Message = "Customize Validate Event Message";
            result.Result = false;
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Write(PageValidate());
    }

    protected void ValidationTextBox1_Validated(Cwing.UI.Validation.ValidateEventArgs e, Cwing.UI.Validation.ValidationResult result)
    {
        if (result.Result)
        {
            //result = new Cwing.UI.Validation.ValidationResult();
            result.Message = "Validate Event Message";
            result.Result = false;
        }
    }
}
